package com.dreamlin.gankio.api

import com.dreamlin.gankio.mvvm.home.GankEntity
import com.dreamlin.gankio.mvvm.home.feature.BannerModel
import com.dreamlin.gankio.net.WrapperBean
import io.reactivex.Observable
import retrofit2.http.*

interface Api {

    @GET("banners")
    fun listBanners(): Observable<WrapperBean<List<BannerModel>>>

    @GET("hot/views/category/GanHuo/count/{count}")
    fun listHots(@Path("count") count: Int): Observable<WrapperBean<List<GankEntity>>>

    @GET("data/category/All/type/{type}/page/{page}/count/{count}")
    fun listCategoryData(
        @Path("type") type: String,
        @Path("page") page: Int,
        @Path("count") count: Int
    ): Observable<WrapperBean<List<GankEntity>>>

    @GET("data/category/Girl/type/Girl/page/{page}/count/{count}")
    fun listGirls(
        @Path("page") page: Int,
        @Path("count") count: Int
    ): Observable<WrapperBean<List<GankEntity>>>


    //下面用协程实现
    /**
     * 获取父级组织
     */
    @POST
    @FormUrlEncoded
    suspend fun getParentBranchKt(
        @Url url: String,
        @Field("id") organizeId: String
    ): WrapperBean<List<Object>>

    /**
     * 获取菜单
     */
    @POST
    suspend fun getMenusKt(
        @Url url: String,
        @Query("id") userId: String,
        @Query("menuPId") menuId: String
    ): WrapperBean<List<Object>>

}